<?php
/**
 * TomatoCMS
 *
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@tomatocms.com so we can send you a copy immediately.
 *
 * @copyright    Copyright (c) 2009-2010 TIG Corporation (http://www.tig.vn)
 * @license        http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @version     $Id: Category.php 2793 2010-05-03 18:48:14Z quanvo $
 * @since        2.0.5
 */

interface Shop_Models_Interface_Category
{
    /**
    * Build category tree with depth for each item
    *
    * @return Tomato_Core_Model_RecordSet
    */
    public function getCategoryTree();
    /**
    * Add new category
    *
    * @param Tomato_Modules_Shop_Models_Category $category
    * @param int $parentId Id of parent category
    * @return int
    */
    public function add($category, $parentId = null);
    /**
    * Get all language
    *
    * @return Tomato_Core_Model_RecordSet
    */
    public function getLanguage();
    /**
    * Get category by given Id
    *
    * @param int $id Id of category
    * @return Tomato_Modules_Shop_Models_Category
    */
    public function getCategoryById($id, $status = null);
    /**
    * Get parent category
    *
    * @param Tomato_Modules_Shop_Models_Category $category
    * @return Tomato_Modules_Shop_Models_Category
    * @since 2.0.3
    */
    public function getParentCategory($category);
    /**
    * Delete category
    *
    * @param Tomato_Modules_Shop_Models_Category $category
    * @return void
    */
    public function delete($category);
    /**
    * Inactive category
    *
    * @param Tomato_Modules_Shop_Models_Category $category
    * @return void
    */
    public function inactive($category_id);
    /**
    * Get all attribute type
    *
    * @return Tomato_Model_RecordSet
    */
    public function getAllAttributes();
    /**
    * Get all product
    *
    * @return Tomato_Model_RecordSet
    */
    public function getAllProducts();
    /**
    * Update category order
    *
    * @since 2.0.7
    * @param Shop_Models_Category $category
    * @return int
    */
    public function updateOrder($category);
    /*----------------------------------Front-end Actions--------------------------------------------*/

    /**
     * Get direct sub category with parent_id = $id
     * @id Id of category
     * @return Tomato_Model_Recordset
     **/
    public function getDirSubCategory($id);

    /**
     * Get all sub category with left > $category->left and right < $category->right
     * @return Tomato_Model_Recordset
     **/
    public function getSubCategory($category);

    /**
     * Get category tree follow current language
     * @return Tomato_Model_Recordset
     **/
    public function getFTree();

    /**
     * Get category by id
     * @param int $id Id of category
     * @return Tomato_Model_Recordset
    **/
    public function getById($id);

    /**
     * Get all sub category
     * @param int $id Id of shop_category
     * @return Tomato_Model_Recordset
    **/
    public function getAllSub($id);

    /**
     * Get all parents of current category
     * @param int $categoryId
     * @return Tomato_Model_Recordset
    **/
    public function getParents($categoryId);
}
